﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NetDon.WebControls;
using NetDon.eBoss.Data.CollectionClasses;
using NetDon.eBoss.Data.EntityClasses;
using NetDon.Utilities;

namespace NetDon.OA.Portal.HtmlTool
{
    public partial class BrandSetting : NetDonPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {


            if (!IsPostBack)
            {


                    var templates = new BrandsettingCollection();
                    templates.GetMulti(null);
                    gridCustomerInfoList.DataSource = templates;
                    gridCustomerInfoList.DataBind();
        

            }
        }



        private bool save()
        {
   

            foreach (GridViewRow detailRow in gridCustomerInfoList.Rows)
            {
                var id = gridCustomerInfoList.DataKeys[detailRow.RowIndex]["Id"].ToString().ToInt32();
                BrandsettingEntity entity = new BrandsettingEntity(id.Value);

                entity.Titlebrand = (detailRow.FindControl("txtTitlebrand") as TextBox).Text.Trim();
                entity.Titlenobrand =( detailRow.FindControl("txtTitlenobrand") as TextBox).Text.Trim();
                entity.Descbrand = (detailRow.FindControl("txtDescbrand") as TextBox).Text.Trim();
                entity.Descnobrand = (detailRow.FindControl("txtDescnobrand") as TextBox).Text.Trim();
                entity.Save();

            }


          
            return true;
        }


        protected void btnSave_Click(object sender, EventArgs e)
        {

            if (save())
            {
                Success("保存成功!");
                CloseWindow(true);
            }



        }




    }

}